package com.yxp.easy;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class ArrayListTest {

    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static void main(String[] args) throws ParseException {
        String dateTest = "2017-06-07";
        System.out.println(sdf.parse(dateTest));
        List<Integer> temp = new ArrayList<Integer>();
        temp.add(2);
        temp.add(4);
        temp.add(200000);
        temp.add(5);
        temp.add(7);
        temp.add(2);
        temp.add(2);

        Collections.shuffle(temp);

        System.out.println(temp);

        temp.remove(new Integer(2));

        System.out.println(temp);

        System.out.println(temp.contains(new Integer(200000)));

        temp.remove(new Integer(200000));

        System.out.println(temp);

        System.out.println(temp.contains(new Integer(200000)));


        List<Integer> copyTest = Collections.nCopies(10, 0);
        System.out.println(copyTest);
//		copyTest.remove(new Integer(0));

        for (Integer tt : temp) {
            System.out.println(tt.hashCode());
        }

        Random random = new Random();
        for (int i = 10; i > 1; i--) {
            System.out.println(random.nextInt(i));
        }

    }
}
